<div class="faculty-committee">
    <div class="view">
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    <?php echo form_open('committee/update_view'); ?>
                        <center>
                            <?php
                            $counter=0;
                            $areahead = ' ';
                            $assistant = ' ';
                            $secretary = ' ';
                            $treasurer = ' ';
                            $members = array();

                            foreach ($tbl as $row) {

                              /*echo $row['Name'];
                              echo $row['Description'];
                              echo $row['ID'];*/

                             if($row['Description'] == 'Area Head')
                             {
                                 $areahead = $row['Name'];
                             }
                             elseif($row['Description'] == 'Treasurer')
                             {
                                  $treasurer = $row['Name'];
                             }
                             elseif($row['Description'] == 'Area Head Assistant')
                             {
                                 $assistant = $row['Name'];
                             }
                             elseif($row['Description'] == 'Secretary')
                             {
                                 $secretary = $row['Name'];
                             }
                             elseif($row['Description'] == 'Members')
                             {
                                 $members[$counter] = $row['Name'];
                                 $counter++;
                             }
                            }
                            ?>

                            <legend>Faculty Committee</legend>
                            <label>Faculty Area Head</label>
                            <input type="text" id="faculty-head" value="<?php echo $areahead;?>"/>

                            <div class="row-fluid">
                                <div class="span12">
                                    <label>Faculty Area Head Assistant</label>
                                    <input type="text" id="faculty-assist" value="<?php echo $assistant;?>"/>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="span12">
                                    <label>Secretary</label>
                                    <input type="text" id="faculty-secretary" value="<?php echo $secretary;?>"/>
                                </div>
                            </div>

                            <div class="row-fluid">
                                <div class="span12">
                                    <label>Treasurer</label>
                                    <input type="text" id="faculty-treasurer" value="<?php echo $treasurer;?>"/>
                                </div>
                            </div>

                            <br/>

                            <label> Members </label>
                                <?php
                                    $ctr = 0;
                                    while($ctr<sizeof($members))
                                    {
                                        $x = $ctr;
                                        $y = $ctr+1;
                                        $z = $ctr+2;
                                        echo "
                                        <div class='row-fluid'>";
                                        if($x<sizeof($members))
                                        {
                                            echo
                                            "
                                            <div class='span4'>
                                                    <input type='text' value='".$members[$x]."'/>
                                            </div>
                                            ";
                                        }
                                        if($y<sizeof($members))
                                        {
                                            echo
                                                "
                                                <div class='span4'>
                                                        <input type='text' value='".$members[$y]."'/>
                                            </div>
                                            ";
                                        }
                                        if($z<sizeof($members))
                                        {
                                            echo
                                                "
                                                <div class='span4'>
                                                        <input type='text' value='".$members[$z]."'/>
                                                </div>
                                            ";
                                        }
                                            $ctr+=3;
                                            echo "</div>";
                                    }
                                    ?>
                            <div class="row-fluid">
                                <div class="span12">
                                <button type="submit" class="btn-primary">UPDATE</button>
                                </div>
                            </div>
                            </form>
                            </center>

                </div>
            </div>
        </div>
    </div>
</div>